﻿using AutoMapper;

namespace FreeDream.Infrastructure
{
    public class CustomProfile : Profile
    {
        //services.AddAutoMapper是会自动找到所有继承了Profile的类然后进行配置，而且我的这个配置文件是在api层的，如果Profile配置类放在别的层（比如Service层），
        //如果没解耦的话，可以services.AddAutoMapper()，参数留空，AutoMapper会从所有引用的程序集里找继承Profile的类，如果解耦了，就得services.AddAutoMapper(Assembly.Load("Core.Service"))。

        /// <summary>
        /// 配置构造函数，用来创建关系映射
        /// </summary>
        public CustomProfile()
        {
            //CreateMap<BlogArticle, BlogViewModel>();

            //CreateMap<Address, AddressDto>()
            //    .ForMember(d => d.Name, o => o.MapFrom(d => d.Name))
            //    .ForMember(d => d.Phone, o => o.MapFrom(d => d.Phone))
            //    .ForMember(d => d.Province, o => o.MapFrom(d => d.Province))
            //    .ForMember(d => d.City, o => o.MapFrom(d => d.City))
            //    .ForMember(d => d.Area, o => o.MapFrom(d => d.Area))
            //    .ForMember(d => d.Detail, o => o.MapFrom(d => d.Detail))
            //    .ForMember(d => d.IsDefault, o => o.MapFrom(d => d.IsDefault));
        }
    }
}